home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / graphic / pbmpl91d.zip / PBMPLUS / SRC / CRT0NEW.S next >
Text File  |  1993-01-08  |  1KB  |  71 lines

  1. /*
  2. ** This is a modified version of the startup code.    All it does is
  3. ** call the function FIX_IO() just before calling main.
  4. ** to compile:     gcc -o crt0new.s
  5. ** to use, make a back up copy of the supplied crt0.o with
  6. ** copy crt0.o crt0old.o
  7. ** then when building an application that you want to use binary io going
  8. ** through stdin/stdout, do:   copy crt0new.o crt0.o
  9. ** Be sure that when you want to build normal io apps again, you do:
  10. ** copy crt0old.o crt0.o
  11. */
  12.  
  13. /*
  14. **    Called as start(argc, argv, envp)
  15. */
  16.  
  17.     .text
  18.     .globl    start
  19. start:
  20.     movl    %esi,___pid
  21.     movl    %edi,___transfer_buffer
  22.     movl    %ebx,_ScreenPrimary
  23.     movl    %ebp,_ScreenSecondary
  24.     xorl    %esi,%esi
  25.     xorl    %edi,%edi
  26.     xorl    %ebp,%ebp
  27.     xorl    %ebx,%ebx
  28.  
  29.     movl    %esp,%ebx
  30.     movl    8(%ebx),%eax
  31.     pushl    %eax
  32.     movl    %eax,_environ
  33.     pushl    4(%ebx)
  34.     pushl    (%ebx)
  35.     call    ___main
  36.     call    _FIX_IO
  37.     call    _main
  38.     addl    $12,%esp
  39.     pushl    %eax
  40.     call    _exit
  41.  
  42. exit_again:
  43.     movl    $0x4c00,%eax
  44.     int    $0x21
  45.     jmp    exit_again
  46.  
  47.     ret
  48.  
  49.     .data
  50.  
  51.     .globl    _environ
  52. _environ:
  53.     .long    0
  54.  
  55.     .globl    ___pid
  56. ___pid:
  57.     .long    0
  58.  
  59.     .globl    ___transfer_buffer
  60. ___transfer_buffer:
  61.     .long    0
  62.  
  63.     .globl    _ScreenPrimary
  64. _ScreenPrimary:
  65.     .long    0
  66.  
  67.     .globl    _ScreenSecondary
  68. _ScreenSecondary:
  69.     .long    0
  70.  
  71.